package com.fengshang.wedding.domain.service.api;

import java.util.Collection;

import com.fengshang.wedding.domain.model.api.IUser;

/**
 * 
 *@author gembin@gmail.com
 * 
 */
public interface IUserManager {
	/**
	 * 
	 * @param user
	 * @throws InvalidUserException
	 */
	public void createGuest(IUser user)throws InvalidUserException;
	/**
	 * create a new user
	 * @param user
	 * @throws InvalidUserException if create a user with ADMIN role
	 */
	public void createUser(IUser user)throws InvalidUserException;
	/**
	 * find user by id
	 * @param id
	 * @return
	 * @throws UserNotFoundException
	 */
	public IUser findUserById(int id) throws UserNotFoundException;
	/**
	 * find user by name
	 * @param name
	 * @return
	 * @throws UserNotFoundException
	 */
	public IUser findUserByName(String name) throws UserNotFoundException;
	/**
	 * remove a user
	 * @param userId
	 * @throws UserNotFoundException
	 */
	public void removeUser(int userId) throws  UserNotFoundException,UserActionNotAllowedException;
	/**
	 * update a user
	 * @param user
	 * @return
	 * @throws UserNotFoundException
	 */
	public IUser updateUser(IUser user) throws UserNotFoundException,InvalidUserException;
	/**
	 * query users
	 * @param query
	 * @param pageSize
	 * @param currentPage
	 * @return
	 */
	public Collection<IUser> findUsersByPagination(String query, int pageSize,
			int currentPage);
	/**
	 * get Total Pages of users
	 * @param pageSize
	 * @return Total Pages
	 */
	public int getTotalPages(int pageSize);
	/**
	 * get Total Pages of users
	 * @return TotalPages
	 */
	public int getTotalPages();
	/**
	 * @return Total Records
	 */
	public int getTotalRecords();

}
